package com.qianfeng.openplatform.webmaster.controller;

import com.qianfeng.openplatform.webmaster.entry.LayuiDataTableSource;
import com.qianfeng.openplatform.webmaster.entry.OpenApiMaster;
import com.qianfeng.openplatform.webmaster.pojo.UserToken;
import com.qianfeng.openplatform.webmaster.service.AppTokenService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 江江
 * @Date 2020/7/23 23:00
 */
@RestController
@RequestMapping("/sys/token")
public class TokenController {
    @Autowired
    private AppTokenService appTokenService;

    @RequestMapping("/table")
    public LayuiDataTableSource tokenTable(@RequestParam(defaultValue = "1") Integer page,
                                           @RequestParam(defaultValue = "10")Integer limit,
                                           String accessToken){

        return appTokenService.getApiTokenMgsToPage(page,limit,accessToken);
    }

    @RequestMapping("/update")
    public OpenApiMaster update(UserToken userToken){
        return appTokenService.updateToken(userToken);
    }
    @RequestMapping("/del")
    public OpenApiMaster del(Integer[] ids){
        return appTokenService.delToken(ids);
    }

}
